define(['jquery', 'bootstrap', 'pageeditor'], function ($, undefined, Pageeditor) {
    var Controller = {
        index: function () {
            Pageeditor.api.init({
                data: {},
                tools: [{
                    name: '基础',
                    class: 'btns-local',
                    navs: 'title,blank,search,line,banner,picturew,picgroup',
                }],
            });
            Pageeditor.api.bindevent();
            $(document).on('click', '.btn-save', function (e) {
                console.log(JSON.stringify(Pageeditor.api.getData()));
                tip.alert(JSON.stringify(Pageeditor.api.getData()));
            });
        },
        preview: function () {
            Pageeditor.api.preview('#preview', {
                "page": {
                    "name": "手机商城",
                    "title": "手机商城",
                    "keyword": "",
                    "desc": "",
                    "img": "",
                    "background": "#f3f3f3"
                },
                "items": {
                    "M1571222070988": {
                        "name": "图片轮播",
                        "params": {},
                        "style": {
                            "dotStyle": "round",
                            "dotAlign": "left",
                            "background": "#ffffff",
                            "leftRight": "5",
                            "bottom": "5",
                            "opacity": "0.8"
                        },
                        "data": {
                            "C1571222070988": {
                                "imgUrl": "//cdn.cnbj1.fds.api.mi-img.com/mi-mall/cf113408e9f30e984dd5e4800c2d3345.jpg?thumb=1&w=720&h=360",
                                "linkUrl": ""
                            },
                            "C1571222070989": {
                                "imgUrl": "//cdn.cnbj1.fds.api.mi-img.com/mi-mall/1d349f5b290fa3dd4ecedd264aa01eae.jpg?thumb=1&w=720&h=360",
                                "linkUrl": ""
                            }
                        },
                        "id": "banner"
                    },
                    "M1571222156877": {
                        "name": "图片橱窗",
                        "params": {"column": "4", "showtype": 1, "rownum": "2"},
                        "style": {
                            "paddingtop": "0",
                            "paddingleft": "0",
                            "showbtn": 0,
                            "background": "#4f5657",
                            "dotStyle": 'rectangle',
                            dotAlign: '',
                            leftRight: '5',
                            bottom: '5',
                            opacity: '0.8'
                        },
                        "data": {
                            "C1571222156877": {
                                "imgurl": "//cdn.cnbj1.fds.api.mi-img.com/mi-mall/cb65daec7ef7b52cc785f88f78efba37.png?thumb=1&w=144&h=152",
                                "linkurl": ""
                            },
                            "C1571222156878": {
                                "imgurl": "//i8.mifile.cn/v1/a1/eb5024fe-dfe3-6e53-3e18-675bef5fa06e.webp",
                                "linkurl": ""
                            },
                            "C1571222156879": {
                                "imgurl": "//cdn.cnbj1.fds.api.mi-img.com/mi-mall/6eb2a9a73687e007daf30fc3f85e0ad2.gif",
                                "linkurl": ""
                            },
                            "C1571222156880": {
                                "imgurl": "//i8.mifile.cn/v1/a1/7dbcbf87-6a58-adb6-2f3f-bb3dae3e9c80.webp",
                                "linkurl": ""
                            },
                            "C1571222156871": {
                                "imgurl": "//cdn.cnbj1.fds.api.mi-img.com/mi-mall/cb65daec7ef7b52cc785f88f78efba37.png?thumb=1&w=144&h=152",
                                "linkurl": ""
                            },
                            "C1571222156872": {
                                "imgurl": "//cdn.cnbj1.fds.api.mi-img.com/mi-mall/cb65daec7ef7b52cc785f88f78efba37.png?thumb=1&w=144&h=152",
                                "linkurl": ""
                            },
                            "C1571222156873": {
                                "imgurl": "//cdn.cnbj1.fds.api.mi-img.com/mi-mall/cb65daec7ef7b52cc785f88f78efba37.png?thumb=1&w=144&h=152",
                                "linkurl": ""
                            },
                            "C1571222156874": {
                                "imgurl": "//cdn.cnbj1.fds.api.mi-img.com/mi-mall/cb65daec7ef7b52cc785f88f78efba37.png?thumb=1&w=144&h=152",
                                "linkurl": ""
                            },
                            "C1571222156875": {
                                "imgurl": "//cdn.cnbj1.fds.api.mi-img.com/mi-mall/cb65daec7ef7b52cc785f88f78efba37.png?thumb=1&w=144&h=152",
                                "linkurl": ""
                            },
                            "C1571222156876": {
                                "imgurl": "//cdn.cnbj1.fds.api.mi-img.com/mi-mall/cb65daec7ef7b52cc785f88f78efba37.png?thumb=1&w=144&h=152",
                                "linkurl": ""
                            },
                            "C1571222156870": {
                                "imgurl": "//cdn.cnbj1.fds.api.mi-img.com/mi-mall/cb65daec7ef7b52cc785f88f78efba37.png?thumb=1&w=144&h=152",
                                "linkurl": ""
                            },
                            "C157122215687x": {
                                "imgurl": "//cdn.cnbj1.fds.api.mi-img.com/mi-mall/cb65daec7ef7b52cc785f88f78efba37.png?thumb=1&w=144&h=152",
                                "linkurl": ""
                            },
                        },
                        "id": "picturew"
                    },
                    "M1571222242803": {
                        "name": "图片橱窗",
                        "params": {"column": "1", "showtype": 0, "rownum": "2"},
                        "style": {
                            "paddingtop": "0",
                            "paddingleft": "0",
                            "showdot": 0,
                            "showbtn": 0,
                            "background": "#ffffff"
                        },
                        "data": {
                            "C1571222242803": {
                                "imgurl": "//cdn.cnbj1.fds.api.mi-img.com/mi-mall/32b5d24417b673008f386592c4d17046.jpg?thumb=1&w=358&h=508",
                                "linkurl": ""
                            },
                            "C1571222242804": {
                                "imgurl": "//cdn.cnbj1.fds.api.mi-img.com/mi-mall/4c2122e9a3763c5d5e6293f34f48fe01.jpg?thumb=1&w=358&h=252",
                                "linkurl": ""
                            },
                            "C1571222242805": {
                                "imgurl": "//cdn.cnbj1.fds.api.mi-img.com/mi-mall/247d997aed9fa00eb2e2ad7f0000cf57.jpg?thumb=1&w=358&h=252",
                                "linkurl": ""
                            }
                        },
                        "id": "picturew"
                    },
                    "M1571222327860": {
                        "name": "单图组",
                        "params": {"column": "1", "showtype": 0, "rownum": "1"},
                        "style": {"paddingtop": "0", "paddingleft": "0", "background": "#ffffff"},
                        "data": {
                            "C1571222327860": {
                                "imgurl": "//cdn.cnbj1.fds.api.mi-img.com/mi-mall/3607c8dfd0353f8b14712b13b40778d5.jpeg?thumb=1&w=720&h=280",
                                "linkurl": ""
                            },
                            "M1571222350737": {
                                "imgurl": "//cdn.cnbj1.fds.api.mi-img.com/mi-mall/8f9b16420365a3f52324074d94c52fdb.jpg?thumb=1&w=720&h=440",
                                "linkurl": ""
                            }
                        },
                        "id": "picgroup"
                    },
                    "M1571222372977": {
                        "name": "图片橱窗",
                        "params": {"column": "2", "showtype": 0, "rownum": "2"},
                        "style": {
                            "paddingtop": "0",
                            "paddingleft": "0",
                            "showdot": 0,
                            "showbtn": 0,
                            "background": "#ffffff"
                        },
                        "data": {
                            "C1571222372977": {
                                "imgurl": "//cdn.cnbj1.fds.api.mi-img.com/mi-mall/918eafcf051967f9d212a649fad7de28.jpg?thumb=1&w=344&h=280",
                                "linkurl": ""
                            },
                            "C1571222372978": {
                                "imgurl": "//cdn.cnbj1.fds.api.mi-img.com/mi-mall/8025107813883a20d3f2d956ad80ea38.jpg?thumb=1&w=344&h=280",
                                "linkurl": ""
                            }
                        },
                        "id": "picturew"
                    },
                    "M1571222433005": {
                        "name": "单图组",
                        "params": {"column": "1", "showtype": 0, "rownum": "1"},
                        "style": {"paddingtop": "0", "paddingleft": "0", "background": "#ffffff"},
                        "data": {
                            "C1571222433005": {
                                "imgurl": "//cdn.cnbj1.fds.api.mi-img.com/mi-mall/95fa21d026bd0a93b16b38ee20e96cab.jpg?thumb=1&w=720&h=440",
                                "linkurl": ""
                            }
                        },
                        "id": "picgroup"
                    }
                }
            });
        },
    };

    return Controller;
});